package models

import (
	"time"

	"gorm.io/datatypes"
)

// MaRobotReportLog [...]
type MaRobotReportLog struct {
	ID                string         `gorm:"autoIncrement:true;primaryKey;column:id;type:bigint;not null"  json:"id" json_old:"ID"`
	Url               string         `gorm:"column:url;type:varchar(255);default:'';comment:链接访问地址"  json:"url" json_old:"Url"`
	Type              int            `gorm:"column:type;type:int;not null;comment:报告类型:1日报2周报3月报4单日空货5连续空货6空货周报7电量报告"  json:"type" json_old:"Type"`
	RobotName         string         `gorm:"column:robot_name;type:text;not null;comment:报告机器"  json:"robot_name" json_old:"RobotName"`
	ObjectName        string         `gorm:"column:object_name;type:varchar(500);not null;comment:报告名称"  json:"object_name" json_old:"ObjectName"`
	WebHookName       int            `gorm:"column:web_hook_name;type:varchar(500);not null;comment:推送机器人名称"  json:"web_hook_name" json_old:"WebHookName"`
	WebHookAddress    string         `gorm:"column:web_hook_address;type:varchar(500);not null;comment:推送链接"  json:"web_hook_address" json_old:"WebHookAddress"`
	MerchantID        string         `gorm:"column:merchant_id;type:text;not null;comment:商户ID"  json:"merchant_id" json_old:"MerchantID"`
	Object            string         `gorm:"column:object;type:bigint;not null;comment:报告对象"  json:"object" json_old:"Object"`
	StartTime         datatypes.Date `gorm:"column:start_time;type:date;default:null"  json:"-" json_old:"StartTime"`
	StartTimeFormated string         `gorm:"-" json:"start_time"`
	EndTime           datatypes.Date `gorm:"column:end_time;type:date;default:null"  json:"-" json_old:"EndTime"`
	EndTimeFormated   string         `gorm:"-" json:"end_time"`
	AddTime           time.Time      `gorm:"column:add_time;type:datetime;default:null"  json:"-" json_old:"AddTime"`
	AddTimeFormated   string         `gorm:"-" json:"add_time"`
	CreatedAt         int64          `gorm:"index:created_at;column:created_at;autoCreateTime;type:int;size:64;comment:创建时间" json:"created_at"`
}

// TableName get sql table name.获取数据库表名
func (m MaRobotReportLog) TableName() string {
	return "ma_robot_report_log"
}

// 模式自动注册
func init() {
	Models = append(Models, &MaRobotReportLog{})
}
